local youminglizan = fk.CreateSkill {

  name = "youminglizan",

  tags = { Skill.Compulsory, },

}


Fk:loadTranslationTable{
  ["youminglizan"] = "礼赞",
  [":youminglizan"] = "锁定技，当你造成伤害时，令目标下一次受到的伤害+1。",

  ["#youminglizan"] = "礼赞：锁定技，当你造成伤害时，令目标下一次受到的伤害+1。",
  ["@jbstg_youminglizan-damage"] = "受到伤害+",
}

youminglizan:addEffect(fk.Damage, {
  name = "jbstg_youminglizan",
  anim_type = "offensive",
  events = {fk.Damage},
  can_trigger = function(self, event, target, player, data)
    if target == player and player:hasSkill(youminglizan.name) then
      return true
    end
  end,
  on_cost = function(self, event, target, player, data)
    return true
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    player.room.logic:getEventsOfScope(GameEvent.ChangeHp, 1, function(e)
     local damage = e.data.damageEvent
     if  damage and player == damage.from then
       room:setPlayerMark(data.to, "@jbstg_youminglizan-damage", 1)
     end
   end, Player.HistoryGame)
  end,
})

youminglizan:addEffect(fk.DamageInflicted, {
  name = "#jbstg_youminglizan_delay",
  anim_type = "negative",
  events = {fk.DamageInflicted},
  frequency = Skill.Compulsory,
  can_trigger = function(self, event, target, player, data)
    if event == fk.DamageInflicted and target then
      return target:getMark("@jbstg_youminglizan-damage") > 0
    end
  end,
  on_cost = function(self, event, target, player, data)
    return true
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    if event == fk.DamageInflicted then
      room:setPlayerMark(target, "@jbstg_youminglizan-damage", 0)
      data.damage = data.damage + 1
    end
  end,
})

return youminglizan